from PIL import Image

file = "man1.jpg"
img = Image.open(file)

x1, x2 = 20, 40
y1, y2 = 20, 40
for x in range(x1, x2):
    for y in range(y1, y2):
        img.putpixel((x, y), (0, 0, 0))  # 黑色
img.show()


x1, x2 = 80, 160
y1, y2 = 80, 160
for x in range(x1, x2):
    for y in range(y1, y2):
        img.putpixel((x, y), (254, 254, 254))  # 白色
img.show()
